package com.epoint.mobile.demo.drag;


import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

import com.epoint.mobileoa.R;

public class ImageCellAdapter extends BaseAdapter
{

	public ViewGroup mParentView = null;
	private Context mContext;

	public ImageCellAdapter(Context c) 
	{
		mContext = c;
	}

	public int getCount() 
	{
		return 30;
	}

	public Object getItem(int position) 
	{
		return null;
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView (int position, View convertView, ViewGroup parent) 
	{
		mParentView = parent;
		ImageCell v = null;
		if (convertView == null) {
			// If it's not recycled, create a new ImageCell.
			v = new ImageCell (mContext);
			v.setLayoutParams(new GridView.LayoutParams(85, 85));
			v.setScaleType(ImageView.ScaleType.CENTER_CROP);
		} else {
			v = (ImageCell) convertView;
		}
		v.mCellNumber = position;
		v.mGrid = (GridView) mParentView;
		v.mEmpty = true;
		v.setBackgroundResource (R.color.cell_empty);
		v.setOnTouchListener ((View.OnTouchListener) mContext);
		v.setOnLongClickListener ((View.OnLongClickListener) mContext);
//		LayoutInflater mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//		final Button btn = (Button) mInflater.inflate(R.layout.btn_mainviewicon, null);
//		btn.setText("同事");
//		Drawable d = mContext.getResources().getDrawable(gvicon.iconImage);
//		d.setBounds(0, 0, d.getMinimumWidth(), d.getMinimumHeight());
//		btn.setCompoundDrawables(null, d, null, null);
		return v;
	}
	
} 
